#include "logs.h"

#include <QFile>
#include <iostream>

void myMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &str)
{
    QString text=qFormatLogMessage(type,context,str);

     QFile outFile("log.txt");
    if(!outFile.open(QIODevice::WriteOnly | QIODevice::Append))
    {
        assert(false);
    }
     QTextStream ts(&outFile);
     ts << text << endl;

}

Logs::Logs()
{
  //  qInstallMessageHandler(myMessageHandler);
    qSetMessagePattern("%{time yyyy-MM-dd hh::mm::ss} %{threadid} [%{type}] [%{file},%{line}]  %{message}");
}
